#ifndef __LIGHT_H__
#define __LIGHT_H__

#include <GL/glut.h>

#include "CoordF.h"

/*
 * Classe: Light
 *
 *   Luz simples para o ambiente 3D
 *
*/

class Light
{
      private:
              GLfloat lightPos[4]
                    , lightAmbient[4]
                    , lightDiffuse[4]
                    , lightSpecular[4];
              
      public:
             Light();
             ~Light() {}
             
             void setPos ( CoordF p ) { for (int i=0;i<3;i++) lightPos[i] = p[i]; glLightfv(GL_LIGHT0, GL_POSITION, lightPos); enable(); }
             CoordF getPos() { return CoordF(lightPos); }
             CoordF getRelPos ( CoordF o ) { return (CoordF(lightPos) - o); }
             void setAmbient ( CoordF a ) { for (int i=0;i<3;i++) lightAmbient[i] = a[i]; glLightfv(GL_LIGHT0, GL_AMBIENT,  lightAmbient); }
             void setDiffuse ( CoordF d ) { for (int i=0;i<3;i++) lightDiffuse[i] = d[i]; glLightfv(GL_LIGHT0, GL_DIFFUSE,  lightDiffuse); }
             void setSpecular ( CoordF s ) { for (int i=0;i<3;i++) lightSpecular[i] = s[i]; glLightfv(GL_LIGHT0, GL_SPECULAR, lightSpecular); }
             
             void enable();
             void disable();
             void init();
};

#endif
